<?php
	$user                           = new model_user();
	$pager                          = new libraries_pager();
	$data                           = array();
	if(isset($_POST['ok'])){
		$key = $_POST['key'];
		$data['key'] = $_POST['key'];
		$data['act']                    = 0;
		$limit                          = 15;
		$pager->set_link("index.php?mod=user&act=search");
		$total                          = $user->total_search($key);
		$start                          = $pager->start();
		$pages                          = $pager->page($total,$limit);
		$data['pagelist']               = $pager->listpage($pages,$start,$limit);
		$data['list']                   = $user->list_search($key,$start,$limit);
		//debug($data['list']);
		$data['title']                  = "Tìm kiếm người dùng";
		$data['template']               = "user/search";
		loadview("layout",$data);
	}else{	
		$key = "";
		$data['key'] = "";
		$data['act']                    = 0;
		$limit                          = 15;
		$pager->set_link("index.php?mod=user&act=search");
		$total                          = $user->total_search($key);
		$start                          = $pager->start();
		$pages                          = $pager->page($total,$limit);
		$data['pagelist']               = $pager->listpage($pages,$start,$limit);
		$data['list']                   = $user->list_search($key,$start,$limit);
		$data['title']                  = "Tìm kiếm người dùng";
		$data['template']               = "user/search";
		loadview("layout",$data);
	}
